package com.cloud.bssp.admin.sysmenu.client;

import com.cloud.bssp.admin.sysmenu.dto.UserDTO;
import com.cloud.bssp.util.R;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author weirx
 * @date 2021/07/08 14:38
 **/
@Component
public class UserClientImpl implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public R pageList(Map<String, Object> params) {
                return R.failed("调用用户服务失败，服务已被降级处理");
            }

            @Override
            public R list(UserDTO userDTO) {
                return R.failed("调用用户服务失败，服务已被降级处理");
            }

            @Override
            public R info(Long id) {
                return R.failed("调用用户服务失败，服务已被降级处理");
            }

            @Override
            public R save(UserDTO userDTO) {
                return R.failed("调用用户服务失败，服务已被降级处理");
            }

            @Override
            public R update(UserDTO userDTO) {
                return R.failed("调用用户服务失败，服务已被降级处理");
            }
        };
    }
}
